import './assets/main.css'

import { createApp, type Plugin } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { keys } from 'lodash'
import 'primevue/resources/primevue.min.css'
//theme
// import "primevue/resources/themes/saga-green/theme.css";
// 自定义主题
import "@/assets/css/theme.css"
// icon
import "primeicons/primeicons.css"
// flex
import "primeflex/primeflex.min.css"

import App from './App.vue'
import router from './router'

import { primeVuePlugins, primevueDirective } from './utils/primevue';



const app = createApp(App)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
app.use(pinia)
app.use(router)

keys(primeVuePlugins).forEach((item: string) => {
  // @ts-ignore
  app.use(primeVuePlugins[item].plugin, primeVuePlugins[item].config || {});
});

// 注册指令
keys(primevueDirective).forEach((directive: string) => {
  // @ts-ignore
  const d =  primevueDirective[directive]
  app.directive(directive, d)
})

export default app
